import { Component } from 'react';
import { InputItem, List, Button, WhiteSpace, Icon, NavBar, Toast } from 'antd-mobile';
const LogUrl = require('@/assets/images/logo.png');
import { history } from "umi"

export default class Register extends Component {
  state = {
    username: '',
    password: '',
  };
  submitRegister = () => {
    Toast.success('注册成功')
    history.push("/login")
  };

  render() {
    return (
      <div className="login_wrapper">
        <div className="logo_class">
          <NavBar
            mode="dark"
            icon={<Icon type="left" />}
            onLeftClick={() => history.goBack()}
          >注册</NavBar>
          <img src={LogUrl} className="logo_img" />
        </div>
        <div className="login_form">
          <List className="login_form_item">
            <InputItem
              placeholder="请输入用户名"
              value={this.state.username}
              onChange={(val) => {
                this.setState({
                  username: val,
                });
              }}
              name="username"
            />
          </List>
          <List className="login_form_item">
            <InputItem
              placeholder="请输入密码"
              value={this.state.password}
              onChange={(val) => {
                this.setState({
                  password: val,
                });
              }}
              type="password"
              name="password"
            />
          </List>
          <WhiteSpace size="xl" />
          <Button type="primary" onClick={this.submitRegister}>
            注册
          </Button>
        </div>
        <div className="footer_class">
          <span>百年大党&nbsp;&nbsp;铁路为锋</span>
        </div>
      </div>
    );
  }
}
